package cn.school.test;

import cn.school.dao.StudentMapper;
import cn.school.entity.Student;
import cn.school.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;
import java.util.Scanner;

public class StudentTest {
    public static void main(String[] args) {
        SqlSession session= MybatisUtil.get(false);
        Scanner input=new Scanner(System.in);
        while (true) {
            System.out.println("学生表操作 2：查询单个 3: 更新 5:分页查询");
            int choice = input.nextInt();
            if (choice == 2) {
                StudentMapper mapper = session.getMapper(StudentMapper.class);
                System.out.println(mapper.getClass().getName());
                Student student= mapper.get(2);
                System.out.println(student);
                session.close();
            }else if(choice==5){
                StudentMapper mapper = session.getMapper(StudentMapper.class);
                System.out.println(mapper.getClass().getName());
//                Student student=new  Student("王","14","113");
//                System.out.println(student);
                session.close();
            }
        }
    }
}
